class Results extends React.Component {
    constructor(props) {
        super(props);
    }
    render() {
        return (
            <h1>
                {
                    /* change code here */
                    this.props.fiftyFifty
                }
            </h1>
        );
    }
}

class GameOfChance extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            counter: 1
        };
        this.handleClick = this.handleClick.bind(this);
    }
    handleClick() {
        this.setState({
            counter: this.state.counter + 1 // change code here
        });
    }
    render() {
        let expression = Math.random() > 0.5; // change code here
        return (
            <div>
                <button onClick={this.handleClick}>Play Again</button>
                {/* change code below this line */}
                {expression == 1 ? (
                    <Results fiftyFifty="You win!" />
                ) : (
                    <Results fiftyFifty="You lose!" />
                )}
                {/* change code above this line */}
                <p>{"Turn: " + this.state.counter}</p>
            </div>
        );
    }
}
